package platform;


import java.util.HashMap;

import log.Log;

import org.apache.commons.configuration.XMLConfiguration;

import service.PacketHandlerService;
import service.ServiceManager;
import util.ThreadPool;
import activity.ActivityManager;
import battlefield.BattleFieldManager;
import event.EventManager;
import game.World;

public class Platform
{

	/*
	 * static EntityManager entityManager; static CombatService combatService;
	 * static World world; 
	 */
	static ThreadPool pool;
	static AppContext appContext;
	static EventManager eventManager;
	static BattleFieldManager battlefiledManager;
	static ActivityManager activityManager;
	static ServiceManager serviceManager;
	static XMLConfiguration configuration;
	static Updater updater;
	static String gameCode;
	static Log log;
	static World world;
	private static HashMap<Short, Integer> opcodeCensus = new HashMap<Short,Integer>();
	

	private static PacketHandlerService packetHandlerService;

	

	public static void setGameCode(String code)
	{
		gameCode = code;
	}

	public static String getGameCode()
	{
		return gameCode;
	}

	public static void setWorld(World w){ world = w; }
	
	public static World getWorld(){ return world; }
	 
	/*
	 * 
	 * public static CombatService getCombatService() { return combatService; }
	 * 
	 * public static void setCombatService(CombatService service) {
	 * Platform.combatService = service; }
	 * 
	 * public static void setAppContext(AppContext context){ appContext =
	 * context; }
	 * 
	 * public static void setEntityManager(EntityManager manager){ entityManager
	 * = manager; }
	 * 
	 * public static void setEventManager(EventManager manager){ eventManager =
	 * manager; }
	 * 
	 * 
	 * 
	 * public static EntityManager getEntityManager(){ return entityManager; }
	 * 
	 * 
	 * 
	 * 
	 * 
	 * 
	 * 
	 * 
	 * }
	 */
	public static AppContext getAppContext()
	{
		return appContext;
	}

	public static void setAppContext(AppContext context)
	{
		appContext = context;
	}

	public static EventManager getEventManager()
	{
		return eventManager;
	}

	public static void setEventManager(EventManager manager)
	{
		eventManager = manager;
	}

	public static ServiceManager getServiceManager()
	{
		return serviceManager;
	}

	public static void setServiceManager(ServiceManager manager)
	{
		serviceManager = manager;
	}
	
	public static XMLConfiguration getConfiguration()
	{
		return configuration;
	}

	public static void setConfiguration(XMLConfiguration conf)
	{
		configuration = conf;
	}

	public static Updater getUpdater()
	{
		return updater;
	}

	public static void setUpdater(Updater u)
	{
		updater = u;
	}

	
	public static void setThreadPool(ThreadPool threadPool)
	{ 
		pool = threadPool;
	}
	  
	public static ThreadPool getThreadPool(){ return pool; }
	 

	public static <T extends Log> T getLog(Class<T> logClass)
	{
		return (T) log;
	}

	public static <T extends Log> void setLog(T logt)
	{
		log = logt;
	}

	public static PacketHandlerService getPacketHandlerService()
	{
		return packetHandlerService;
	}

	public static void setPacketHandlerService(PacketHandlerService packetHandlerService)
	{
		Platform.packetHandlerService = packetHandlerService;
	}

	public static void setBattlefieldMananger(BattleFieldManager bm) 
	{
		battlefiledManager = bm;
	}
	
	public static BattleFieldManager getBattlefieldMananger()
	{
		return battlefiledManager;
	}

	public static ActivityManager getActivityManager() 
	{
		return activityManager;
	}

	public static void setActivityManager(ActivityManager activityManager)
	{
		Platform.activityManager = activityManager;
	}

	public static HashMap<Short, Integer> getOpcodeCensus() 
	{
		return opcodeCensus;
	}

	public static void setOpcodeCensus(HashMap<Short, Integer> opcodeCensus)
	{
		Platform.opcodeCensus = opcodeCensus;
	}
	
}
